#include "salesdialog.h"

SalesDialog::SalesDialog(QWidget *parent, MainWindow *_MainWindow) :
    QDialog(parent),
    ui(new Ui::SalesDialog),
    sMainWindow(_MainWindow)
{
    ui->setupUi(this);
    setWindowFlags(windowFlags()& ~Qt::WindowMaximizeButtonHint);
    setFixedSize(this->width(), this->height());
    QDateTime current_date_time=QDateTime::currentDateTime();
    QString current_date=current_date_time.toString("yyyy.MM.dd hh:mm:ss ddd");
    ui->day_label->setText(current_date);
    ui->sales_pushButton->setEnabled(false);
}

SalesDialog::~SalesDialog()
{
    qDebug()<<"SalesDialog 资源释放";
    delete ui;
}

void SalesDialog::closeEvent(QCloseEvent *event)
{
    event = event;
    //TODO: 在退出窗口之前，实现希望做的操作
    emit salesClose(0);
}




void SalesDialog::on_purchase_pushButton_clicked()
{
    sMainWindow->pdlg->show();
    this->close();
}

void SalesDialog::on_vip_pushButton_clicked()
{
    //sMainWindow->vdlg->update_vipinfo();    //刷新界面数据
    sMainWindow->vdlg->show();
    this->close();
}

void SalesDialog::on_exit_pushButton_clicked()
{
    sMainWindow->edlg->show();
    this->close();
}

void SalesDialog::on_day_label_linkActivated(const QString &link)
{

}

void SalesDialog::on_time_label_linkActivated(const QString &link)
{

}

void SalesDialog::on_sales_pushButton_clicked()
{

}

void SalesDialog::updata_time()
{
    ui->day_label->setText(QDateTime::currentDateTime().toString("yyyy.MM.dd hh:mm:ss ddd"));
}
